package com.xwj.controller;

import com.xwj.service.UserService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

@RestController
@RequestMapping("/user")
public class UserController {

    @Reference
    private UserService userService;

    @RequestMapping("/find")
    public ModelAndView find(){
        ModelAndView modelAndView = new ModelAndView();

        userService.FindAll().forEach(o -> System.out.println(o));
        List list = userService.FindAll();
        modelAndView.addObject("ListUser",list);
        modelAndView.setViewName("/user.jsp");

        return modelAndView;
    }
}
